/**
 * 
 */
package dms.presentation.action.student;

import java.util.HashMap;
import java.util.Map;

import net.sf.json.JSONObject;

import org.apache.struts.actions.MappingDispatchAction;

import dms.model.role.Student;
import dms.model.role.wrapper.StudentWrapper;
import dms.util.ContextUtil;

/**
 * @author 李健
 *
 */
public class StudentBaseAction extends MappingDispatchAction {
	
	protected Student getDormitory() {
		StudentWrapper studentWrapper = (StudentWrapper) ContextUtil.getContext().getBean("studentWrapper");
		Student student = studentWrapper.getStudent();
		return student;
	}
	
	protected StudentWrapper getStudentWrapper() {
		StudentWrapper studentWrapper = (StudentWrapper) ContextUtil.getContext().getBean("studentWrapper");
		return studentWrapper;
	}
	
	protected JSONObject makeJSONObject(boolean status, String message) {
		Map jsonMap = new HashMap();
		jsonMap.put("status", status);
		jsonMap.put("message", message);
		return JSONObject.fromObject(jsonMap);
	}
}
